<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/3/11
 * Time: 15:15
 */

echo "<title>6-15 PHP中结构嵌套之循环嵌套</title>";
echo "<p style='text-align: center'><a href=\"index.php\"><font size=\"4\">目录</font></a></p>";
header("Content-type: text/html; charset=utf-8");
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";

$students = array(
    '2010'=>array('令狐冲','59'),
    '2011'=>array('林之平','44'),
    '2012'=>array('曲洋','89'),
    '2013'=>array('任盈盈','92'),
    '2014'=>array('向问天','93'),
    '2015'=>array('任我行','87'),
    '2016'=>array('冲虚','58'),
    '2017'=>array('方正','74'),
    '2018'=>array('岳不群','91'),
    '2019'=>array('宁中则','90'),
);//10个小学生的学号、姓名、分数、用数组存储

foreach($students as $key=>$val)
{
    echo $key;//输出学号
    echo ":";
    //循环输出姓名和分数
    foreach($val as $v)
    {
        echo $v;
    }
    echo "<br />";
}